<template>
    <h2>添加页面</h2>
    <table>
        <tr>
            <td>
                投资名称
            </td>
            <td>
                <input type="text" v-model="I_Name" id="I_Name">
            </td>
        </tr>
        <tr>
            <td>
                投资总额度
            </td>
            <td>
                <input type="text" v-model="I_Budget" id="I_Budget">
            </td>
        </tr>
        <tr>
            <td>

            </td>
            <td>
                <input type="button" value="添加" @click="add">
            </td>
        </tr>
    </table>
</template>
<script lang="ts" setup>
import { ref } from 'vue';

import axios from 'axios';

const I_Name = ref('');
const I_Budget = ref('');

const add = () => {
    axios.post('http://localhost:46407/api/Demo/Add', {
        I_Name: I_Name.value,
        I_Budget: I_Budget.value

    })
        .then(res => {
            if (res.data > 0) {
                alert("添加成功");
                location.href = '/InsertShow'
                return;
            }
            else {
                alert("添加失败");
                return;
            }
        })
}


</script>